@svizzle/utils/[any-any]-[object-number]

Methods

(static) valuesMaxWith(fn) → {function}

Source:
Since:
  • 0.1.0

Return a function expecting an object, applying the provided function to its values and returning the largest of the results.

Example
> maxWithAbsSin = valuesMaxWith(_.pipe([Math.sin, Math.abs]))
> maxWithAbsSin({a: -Math.PI/2, b: -Math.PI/4}))
1
> maxWithAbsSin({a: -Math.PI/4, b: -Math.PI/6}))
0.7071067811865475
Parameters:
Name Type Description
fn function
Returns:
  • Object -> Number
Type
function

(static) valuesMinWith(fn) → {function}

Source:
Since:
  • 0.1.0

Return a function expecting an object, applying the provided function to its values and returning the lowest of the results.

Example
> minWithAbsSin = valuesMinWith(_.pipe([Math.sin, Math.abs]))
> minWithAbsSin({a: -Math.PI/2, b: -Math.PI/4}))
0.7071067811865475
> minWithAbsSin({a: -Math.PI/4, b: -Math.PI/6}))
0.49999999999999994
Parameters:
Name Type Description
fn function
Returns:
  • Object -> Number
Type
function